#pragma once

#include <memory>
#include "PartOfBattle.h"

#define MAX_PART 4

class Utils;
#if (_MSC_VER == 1700)  
typedef std::shared_ptr<Utils> UtilsPtr;
#else
typedef boost::shared_ptr<Utils> UtilsPtr;
#endif

#if (_MSC_VER == 1700)  
#include <thread>
typedef std::thread ThreadType;
#else
#include <boost/thread.hpp>
typedef boost::thread ThreadType;
#endif

const int s_dx [4] = {0,-1,0,1};
const int s_dy [4] = {-1,0,1,0};

class Utils
{
private:
	static UtilsPtr m_Instance;
	Utils();
	ListOfEncode m_setOfBattle;
	PartOfBattlePtr m_parts[4];
	float m_add[MAX_H][MAX_V];
	BattleShipPtr m_battle;
public:
	~Utils();
	static UtilsPtr GetInstance();
	ListOfEncode GetSetOfBattle();
	void LoadFromFile();
	void Initialize();
	Point GuessPos();
	void FoundShip(Point p, Ship::TypeOfShip _type);
	void ProcessPos(Point p, bool value);
	void EndSet();
};

